
import { GraphNode } from "@/js/components/GraphNode"
import { InputLinkNodeObject } from "@/js/components/InputLinkNode"


const objectList = [
//   "super",
//   "this",
  "window",
  'TypedArray',
  "Array",
  "Boolean",
  "Date",
  "Error",
  "EvalError",
  "Function",
  "JSON",
  "Math",
  "Number",
  "Object",
  "Promise",
  "RegExp",
  "String",
  "Symbol",
  "TypeError",
  "URIError",
  "Map",
  "Set",
  "WeakMap",
  "WeakSet",
  "ArrayBuffer",
  "DataView",
  "Float32Array",
  "Float64Array",
  "Int8Array",
  "Int16Array",
  "Int32Array",
  "Uint8Array",
  "Uint16Array",
  "Uint32Array",
  "Uint8ClampedArray",
  "BigInt",
  "BigInt64Array",
  "BigUint64Array",
  "Generator",
  "GeneratorFunction",
  "AsyncFunction",
  "Proxy",
  "Reflect",
  "Intl",
  "WebAssembly",
  'Window',
  'Document',
  'Navigator',
  'Location',
  'XMLHttpRequest',
  'FormData',
  'Image',
  'Audio',
  'Video'
]
const ClassList:ObjectType<any> = {}

function generator(className:string) {
    const classCode =  `class IN_${className} extends GraphNode{
        layout = null
        //targetObject = ${className}
        load(){
            super.load()
    
            const layout = new this.DefaultLayout(this, this.graphView, false, false)
            this.layout = layout
            this.appendChild(layout.container)
    
            layout.main.right.appendChild(new InputLinkNodeObject(this, this.graphView, {
                name: "Array",
                desc: '数组对象',
                model: 'output',
                showInput: false,
                linkMaxCount: 100000,
            }))
        }

        getLinkValue(){
            return ${className}
        }
    }`
    
    ClassList[className] = new Function(`
        return (GraphNode, InputLinkNodeObject)=>{
            return ${classCode}
        }
    `)()(GraphNode, InputLinkNodeObject)
    

    ClassList[className].parser = ({node,toNode}: any) => {
        return className
    }
}

objectList.forEach(className=> generator(className))

export default ClassList